package br.com.hectordufau.rpgiiidetmobile;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;

public class MainActivity extends Activity {

	private static String TAG = MainActivity.class.getName();
	private static long SLEEP_TIME = 5;
	   
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		IntentLauncher launcher = new IntentLauncher();
        launcher.start();
	}

	/*@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}*/
	
	private class IntentLauncher extends Thread {
				
	    @Override
	    /**
	     * Sleep for some time and than start new activity.
	     */
	    public void run() {
	       try {
	          // Sleeping
	          Thread.sleep(SLEEP_TIME*1000);
	       } catch (Exception e) {
	          Log.e(TAG, e.getMessage());
	       }

	       // Start main activity
	       Intent intent = new Intent(MainActivity.this, TelaPrincipal.class);
	       MainActivity.this.startActivity(intent);
	       MainActivity.this.finish();
	    }
	}
}


